#include <forward_list>
#include <fstream>
#include <iostream>
#include <sstream>
#include <string>
#include <vector>

using namespace std;

int main(int argc, char **argv) {
  string s = "acenmorsuvwxz";
  // ifstream infile(argv[1]);
  ifstream infile("1.txt");
  string str;
  infile >> str; //单词文件读入
  cout << "原字符串为：" << str << endl;

  unsigned pos1 = 0;
  unsigned pos2 = 0;
  unsigned _legenth = 0;
  unsigned pos3 = 0;

  while ((pos1 = str.find_first_of(s, pos1)) !=
         string::npos) //找到第一个不出头字符
  {
    pos2 = pos1;
    if ((pos2 = str.find_first_not_of(s, pos2)) !=
        string::npos) //从第一个不出头字符开始找到第一个出头字符
    {
      if (pos2 - pos1 >= _legenth) //找出最大长度并记录此区间的首位置
      {
        _legenth = pos2 - pos1;
        pos3 = pos1;
      }
    }
    ++pos1;
  }
  string _string = str.substr(pos3, _legenth);
  cout << "最长不出头串：" << _string << endl;
  return 0;
}